/** @jsxImportSource @emotion/react */
import * as React from "react";
import {
  CCell, Cell, Table, TableBody, TableRow, Text, TableHead,
} from "customize-easy-ui-component";
import {DirectLink} from "../../routing/Link";
import {item现场施工o} from "./editorOnsite";
import {TailMenRowIspCheck} from "../contain/rarelyVary";
import {useFixRowPrefUnt} from "../hook/useFixRowPrefUnt";

const tailRender=(orc: any, name: string)=><>
  <CCell>{orc?.[name]?.c??'／'}</CCell>
  <CCell>{orc?.[name]?.m??'／'}</CCell>
</>;
export const OnSiteConstruction= ({orc, rep} :{orc:any, rep:any}
) => {
  //const theme= useTheme();
  const [renders]=useFixRowPrefUnt({orc, rep, config:item现场施工o, tailRender, });
  return <>
    <div css={{"@media print": {paddingBottom: '3.3rem', pageBreakInside: 'avoid'}} }>
      <Text id='SiteConstruct' variant="h2" css={{textAlign: 'center', marginTop: '1rem',
      }}>受检单位基本情况及现场施工情况报告</Text>
      <div css={{display: 'flex', justifyContent: 'space-between'}}>
        <Text></Text>
        <Text>报告编号：{rep.isp.no}</Text>
      </div>
    </div>
    <Table fixed={["4.5%", "5%", "%",  "29%", "29%"]} css={{borderCollapse: 'collapse', "@media print": {marginTop: '-3.3rem'}}} tight  miniw={800}>
      <TableHead>
          <TableRow>
            <CCell><Text css={{fontSize:'0.75rem'}}>序号</Text></CCell><CCell colSpan={2}>项目内容</CCell><CCell>施工单位</CCell><CCell>检测机构</CCell>
          </TableRow>
      </TableHead>
      <TableBody>
        <DirectLink href={`/report/${rep?.modeltype}/ver/${rep?.modelversion}/${rep?.id}/SiteConstruct#SiteConstruct`}>
        {renders}
      </DirectLink>
      </TableBody>
    </Table>
    <TailMenRowIspCheck orc={orc} rep={rep} cap={'监检员'} href={`/report/${rep?.modeltype}/ver/${rep?.modelversion}/${rep?.id}/ProjectList#ProjectList`}>
      <DirectLink href={`/report/${rep?.modeltype}/ver/${rep?.modelversion}/${rep?.id}/SiteConstruct#SiteConstruct`}>
        <TableRow>
          <Cell colSpan={2}><div css={{
            minHeight: '3rem',whiteSpace:'pre-wrap'
          }}>备注：<br/>{orc.现场备注|| '／'}</div></Cell>
        </TableRow>
      </DirectLink>
    </TailMenRowIspCheck>
  </>;
};

